﻿using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;

namespace Furesoft.Styling.Design
{
    public partial class ColorHint : UserControl
    {
        private readonly FastColoredTextBoxNS.FastColoredTextBox edit;

        public ColorHint(Color c, FastColoredTextBoxNS.FastColoredTextBox edit)
        {
            InitializeComponent();

            pictureBox1.Image = GenImg(new SolidBrush(c));
            this.edit = edit;
            label1.Text = "R: " + c.R;
            label2.Text = "G: " + c.G;
            label3.Text = "B: " + c.B;
        }

        private Image GenImg(Brush b)
        {
            var bmp = new Bitmap(16, 16);
            var gr = Graphics.FromImage(bmp);

            gr.FillRectangle(b, new Rectangle(0, 0, 16, 16));

            return bmp;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            edit.ClearHints();
        }
    }
}
